package com.zwz.voObject;

import lombok.Data;
import java.util.List;
import java.util.Map;

@Data
public class DatabaseMetaVO {
    private Integer code;
    private String message;
    private MetaData data;

    @Data
    public static class MetaData {
        private List<TableInfo> tables;
    }

    @Data
    public static class TableInfo {
        private String tableName;
        private List<ColumnInfo> columns;
    }

    @Data
    public static class ColumnInfo {
        private String columnName;
        private String dataType;
        private String columnComment;
        private Boolean isNullable;
        private Boolean isPrimaryKey;
    }

    public static DatabaseMetaVO success(List<TableInfo> tables) {
        DatabaseMetaVO vo = new DatabaseMetaVO();
        vo.setCode(200);
        vo.setMessage("success");
        
        MetaData metaData = new MetaData();
        metaData.setTables(tables);
        vo.setData(metaData);
        
        return vo;
    }

    public static DatabaseMetaVO error(String message) {
        DatabaseMetaVO vo = new DatabaseMetaVO();
        vo.setCode(500);
        vo.setMessage(message);
        return vo;
    }
} 